package com.ruoyi.project.comp.comment.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.project.comp.work.domain.CompWork;
import com.ruoyi.project.system.user.domain.User;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;

/**
 * 作品评论对象 comp_comment
 *
 * @author ruoyi
 * @date 2025-11-02
 */
public class CompComment extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 评论ID，主键
     */
    private Long id;

    /**
     * 关联作品ID（外键）
     */
    @Excel(name = "关联作品ID", readConverterExp = "外=键")
    private Long workId;

    /**
     * 评论用户ID（关联用户表）
     */
    @Excel(name = "评论用户ID", readConverterExp = "关=联用户表")
    private Long userId;

    /**
     * 评论内容
     */
    @Excel(name = "评论内容")
    private String content;

    /**
     * 评论时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "评论时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date commentTime;

    /**
     * 父评论ID（用于回复功能，自关联）
     */
    @Excel(name = "父评论ID", readConverterExp = "用=于回复功能，自关联")
    private Long pid;
    private String status;


    private CompWork work; // 关联作品
    private User user; // 关联用户

    private List<CompComment> child;


    private Integer likeCount;
    private String userName;

    public Integer getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(Integer likeCount) {
        this.likeCount = likeCount;
    }

    public List<CompComment> getChild() {
        return child;
    }

    public void setChild(List<CompComment> child) {
        this.child = child;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public CompWork getWork() {
        return work;
    }

    public void setWork(CompWork work) {
        this.work = work;
    }

// ====================================== 自定义字段开始 ======================================
    // 在此处添加的自定义字段，重新生成代码时不会被覆盖
    // 示例：
    // private String customField; // 自定义扩展字段
    // ====================================== 自定义字段结束 ======================================


    // ====================================== 自定义方法开始 ======================================
    // 在此处添加的自定义getter/setter或其他方法，重新生成代码时不会被覆盖
    // 示例：
    // public String getCustomField() { return customField; }
    // public void setCustomField(String customField) { this.customField = customField; }
    // ====================================== 自定义方法结束 ======================================


    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    public Long getWorkId() {
        return workId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    public Date getCommentTime() {
        return commentTime;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Long getPid() {
        return pid;
    }


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("workId", getWorkId())
                .append("userId", getUserId())
                .append("content", getContent())
                .append("commentTime", getCommentTime())
                .append("pid", getPid())
                // ====================================== 自定义toString开始 ======================================
                // 手动添加自定义字段的toString内容，例如：
                // .append("customField", getCustomField())
                // ====================================== 自定义toString结束 ======================================
                .toString();
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return status;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserName() {
        return userName;
    }
}